package com.fwmagic.dp._6._6_2;

import java.lang.reflect.Proxy;

public class Main {
    public static void main(String[] args) {
        IGamePlayer gamePlayer = new GamePlayer("小六");

        System.out.println("开始时间是:2020-01-01 09:00:00");

        //动态代理，代理IGamePlayer
        IGamePlayer proxy = (IGamePlayer)Proxy.newProxyInstance(
                gamePlayer.getClass().getClassLoader(),
                gamePlayer.getClass().getInterfaces(),
                new GamePlayInvocationHandler(gamePlayer));

        proxy.login("小6","123456");

        proxy.killBoss();

        proxy.upgrade();

        System.out.println("结束时间是:2020-01-02 03:00:00");
    }
}
